package com.glasses.primework;


import javax.faces.bean.ManagedBean;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

@ManagedBean
public class BeanValidationBean {
    @NotNull(message = "This field cannot be empty!")
    private String firstName;
    @Pattern(regexp = "[a-z]", message = "Only small letters from a-z are allowed!")
    private String lastName;
    @Min(value = 1, message = "Age cannot be lower than 1")
    @Max(value = 100, message = "Age cannot be higher than 100!")
    private int age;
    
    public String getFirstName() {
        return firstName;
    }
    
    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }
    
    public String getLastName() {
        return lastName;
    }
    
    public void setLastName(String lastName) {
        this.lastName = lastName;
    }
    
    public int getAge() {
        return age;
    }
    
    public void setAge(int age) {
        this.age = age;
    }
    
    public void save() {
        System.out.println("BeanValidationBean.save() triggered!");
    }
}
